3.72 \(\int \frac{1+x+x^2}{(1+x^2)^2} \, dx\)

Optimal. Leaf size=14 \[ \tan ^{-1}(x)-\frac{1}{2 \left (x^2+1\right )} \]

[Out]

-1/(2*(1 + x^2)) + ArcTan[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0109896, antiderivative size = 14, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.214, Rules used = {1814, 12, 203} \[ \tan ^{-1}(x)-\frac{1}{2 \left (x^2+1\right )} \]

Antiderivative was successfully verified.

[In]

Int[(1 + x + x^2)/(1 + x^2)^2,x]

[Out]

-1/(2*(1 + x^2)) + ArcTan[x]

Rule 1814

Int[(Pq_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[Pq, a + b*x^2, x], f = Coeff[P
olynomialRemainder[Pq, a + b*x^2, x], x, 0], g = Coeff[PolynomialRemainder[Pq, a + b*x^2, x], x, 1]}, Simp[((a
*g - b*f*x)*(a + b*x^2)^(p + 1))/(2*a*b*(p + 1)), x] + Dist[1/(2*a*(p + 1)), Int[(a + b*x^2)^(p + 1)*ExpandToS
um[2*a*(p + 1)*Q + f*(2*p + 3), x], x], x]] /; FreeQ[{a, b}, x] && PolyQ[Pq, x] && LtQ[p, -1]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{1+x+x^2}{\left (1+x^2\right )^2} \, dx &=-\frac{1}{2 \left (1+x^2\right )}-\frac{1}{2} \int -\frac{2}{1+x^2} \, dx\\ &=-\frac{1}{2 \left (1+x^2\right )}+\int \frac{1}{1+x^2} \, dx\\ &=-\frac{1}{2 \left (1+x^2\right )}+\tan ^{-1}(x)\\ \end{align*}

Mathematica [A]  time = 0.0067723, size = 14, normalized size = 1. \[ \tan ^{-1}(x)-\frac{1}{2 \left (x^2+1\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + x + x^2)/(1 + x^2)^2,x]

[Out]

-1/(2*(1 + x^2)) + ArcTan[x]

________________________________________________________________________________________

Maple [A]  time = 0.045, size = 13, normalized size = 0.9 \begin{align*} -{\frac{1}{2\,{x}^{2}+2}}+\arctan \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2+x+1)/(x^2+1)^2,x)

[Out]

-1/2/(x^2+1)+arctan(x)

________________________________________________________________________________________

Maxima [A]  time = 1.4843, size = 16, normalized size = 1.14 \begin{align*} -\frac{1}{2 \,{\left (x^{2} + 1\right )}} + \arctan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+x+1)/(x^2+1)^2,x, algorithm="maxima")

[Out]

-1/2/(x^2 + 1) + arctan(x)

________________________________________________________________________________________

Fricas [A]  time = 0.980056, size = 58, normalized size = 4.14 \begin{align*} \frac{2 \,{\left (x^{2} + 1\right )} \arctan \left (x\right ) - 1}{2 \,{\left (x^{2} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+x+1)/(x^2+1)^2,x, algorithm="fricas")

[Out]

1/2*(2*(x^2 + 1)*arctan(x) - 1)/(x^2 + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.104805, size = 10, normalized size = 0.71 \begin{align*} \operatorname{atan}{\left (x \right )} - \frac{1}{2 x^{2} + 2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2+x+1)/(x**2+1)**2,x)

[Out]

atan(x) - 1/(2*x**2 + 2)

________________________________________________________________________________________

Giac [A]  time = 1.16207, size = 16, normalized size = 1.14 \begin{align*} -\frac{1}{2 \,{\left (x^{2} + 1\right )}} + \arctan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((x^2+x+1)/(x^2+1)^2,x, algorithm="giac")

[Out]

-1/2/(x^2 + 1) + arctan(x)